/*
引入依赖包
最低SDK版本要求：viapi20230117的SDK版本需大于等于2.0.1。
可以在此仓库地址中引用最新版本SDK：https://mvnrepository.com/artifact/com.aliyun/viapi20230117
<!-- https://mvnrepository.com/artifact/com.aliyun/viapi20230117 -->
<dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>viapi20230117</artifactId>
      <version>${aliyun.viapi.version}</version>
</dependency>
*/

import com.aliyun.tea.TeaModel;
import com.aliyun.viapi20230117.models.QueryAsyncJobListResponse;

public class QueryAsyncJobList {
    public static com.aliyun.viapi20230117.Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填，您的 AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 必填，您的 AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名
        config.endpoint = "viapi.cn-shanghai.aliyuncs.com";
        return new com.aliyun.viapi20230117.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        // "YOUR_ACCESS_KEY_ID", "YOUR_ACCESS_KEY_SECRET" 的生成请参考https://help.aliyun.com/document_detail/175144.html
        // 如果您是用的子账号AccessKey，还需要为子账号授予权限AliyunVIAPIFullAccess，请参考https://help.aliyun.com/document_detail/145025.html
        com.aliyun.viapi20230117.Client client = QueryAsyncJobList.createClient(
                "LTAIBqFbkm0FZ1K6",
                "1inhunDMjbB7nsDvac2vI1JtPaRjBn");
        com.aliyun.viapi20230117.models.QueryAsyncJobListRequest queryAsyncJobListRequest = new com.aliyun.viapi20230117.models.QueryAsyncJobListRequest()
                .setJobId("15C0614A-B906-5C67-AABA-3D02D0BB4BF9")
                .setStartTime("2023-04-28 00:00:00")
                .setEndTime("2023-04-28 23:00:00");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            QueryAsyncJobListResponse queryAsyncJobListResponse = client.queryAsyncJobListWithOptions(queryAsyncJobListRequest, runtime);
            // 获取整体结果。
            System.out.println(com.aliyun.teautil.Common.toJSONString(TeaModel.buildMap(queryAsyncJobListResponse)));
            // 获取单个字段。
            System.out.println(queryAsyncJobListResponse.getBody());
        } catch (com.aliyun.tea.TeaException teaException) {
            // 获取整体报错信息。
            System.out.println(com.aliyun.teautil.Common.toJSONString(teaException));
            // 获取单个字段。
            System.out.println(teaException.getCode());
        }
    }
}